import { getLoader } from '../utils'

import { Replacement, RollupReplaceOptions } from '@rollup/plugin-replace'

export const replacePlugin = function (define: { [str: string]: Replacement }) {
    const replace = getLoader<RollupReplaceOptions>('@rollup/plugin-replace')
    return replace({
        preventAssignment: true,
        values: {
            ...define
        }
    })
}
